package xuesm.strategy.pay;

/**
 * @Author: xuesm
 * @Description: 订单类
 * @Date: Create in 20:15 2019/4/12
 */
public class Order {


	private String uid;
	private String orderId;
	private double amount;


	public Order(String uid, String orderId, double amount) {
		this.uid = uid;
		this.orderId = orderId;
		this.amount = amount;
	}

	public PayState pay(){
		return pay(PayStrategy.DEFAULT_PAY);
	}

	public PayState pay(String payKey){

		Payment payment = PayStrategy.getPayment(payKey);
		System.out.println("欢迎使用" + payment.getName() + "支付");
		System.out.println("本次交易的金额为：" + amount + ", 开始扣款。。。。");
		PayState payState = payment.pay(uid, amount);
		return payState;
	}
}
